<?php
//用户账户
namespace app\adminbackstage\model;

use think\Model;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class User_amount extends Model{

    // 模型初始化
    protected static function init()
    {
        parent::init();
        //TODO:初始化内容
    }
    
//    //单个用户
//    public function find($value,$type = "uid"){
//        $find = $this::name('user_amount')->where($type,'=',$value)->find();
//        return $find;
//    }
    
    //添加账户
    public function add_user_amount($data){
        $id = $this::name('user_amount')->insertGetId($data);
        return $id;
    }
    
    //账户信息
    public function userFind($uid){
        
        $info = $this::name('user_amount')->where('uid','=',$uid)->find();
        return $info;
    }
    
    
    //账号金额变更
    public function auditRecharge($uid,$balance){
        $in = $this::update(['balance' => $balance], ['uid' => $uid]);
        return $in;
    }

    //账号金额变更
    public function auditRechargeA($uid,$accumulated_amount){
        $in = $this::update(['accumulated_amount' => $accumulated_amount], ['uid' => $uid]);
        return $in;
    }
    
    
    public function user_amountUpdate($uid,$update) {
        $in = $this::update($update, ['uid' => $uid]);
        return $in;
    }
    
        //添加资金账户
    public  function user_amountAdd(array $data){
        return self::create($data);
    }
    
}
